#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：zhcx-service-test-master 
@File    ：listing_strategy_service.py
@Author  ：关依林
@Date    ：2023/9/13 16:06 
'''
from testcases.ProductGrading_Strategy.AmazonListing.controller.grading_base_way import *
from testcases.ProductGrading_Strategy.AmazonListing.service.listing_grading_public_way import *
from testcases.ProductGrading_Strategy.public_dispatch_way import *

class ListingStrategyService:

    def strategyDataVerify(self):
        """
        验证思路
        1.获取策略条件
        2.判断是否执行SKU分级策略
        3.判断是否指定SKU数据
        4.通过SKU过滤产品风险等级、平台禁售
        """
        strategyID = 19
        cursorStrategy = connectMysql("Java_centerStrategy")
        cursorProduct = connectMysql("Java_strategyProduct")
        cursorListing = connectMysql("Java_strategyListing")
        cursorData = connectMysql("Java_strategyData")
        orderSourceIdList = getCountryOrderSourceId(cursorProduct)
        strategyRule = getStrategyTemplate(cursorStrategy, strategyID)

        sourceData = []
        for orderSourceId in orderSourceIdList:
            tempSourceData = gradingStrategyListingData(
                orderSourceId ,cursorStrategy,cursorData,
                cursorProduct, cursorListing, strategyRule, strategyID
            )
            sourceData += tempSourceData

        strategyResult = getStrategyData(cursorStrategy, strategyID, orderSourceIdList[0])
        matchingResult = tuple(set(sourceData) - set(strategyResult))
        matchingResult2 = tuple(set(strategyResult) - set(sourceData))
        return matchingResult

if __name__ == '__main__':
    ListingStrategyService().strategyDataVerify()